﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Beetle.Redis.TestConsole
{
    class Program
    {
        static int mCount;

        static int mLastCount;

        static void Main(string[] args)
        {
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            System.Threading.ThreadPool.QueueUserWorkItem(TestList);
            while (true)
            {
                System.Threading.Thread.Sleep(1000);
                Console.WriteLine("{0}/{1}",mCount - mLastCount, mCount );
                mLastCount = mCount;
            }
            
        }
        static void TestList(object state)
        {
            Beetle.Redis.ProtobufList<Beetle.RedisClient.TestLib.Order> orders = "Orders";
            while (true)
            {
                IList<Beetle.RedisClient.TestLib.Order> items= orders.Range(10, 12);
                System.Threading.Interlocked.Increment(ref mCount);
            }
            
        }
    }
}
